home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
os2
/
mbase101.zip
/
RIO112.Zip
/
example2.nrx
< prev
next >
Wrap
Text File
|
1996-08-18
|
1KB
|
52 lines
/* A simple netrexx program, demonstrating the
use of binary file oriented charin/charout.
There is a corresponding OS/2 REXX example2.cmd
for a simple evaluation of the effort to spend
in the port REXX --> NetREXX. */
import RXFile
File1 = RXFile()
File2 = RXFile()
stdin = RXFile()
ok = Rexx null
bytes = Rexx null
fname = Rexx null
say ' '
say 'This program creates a copy of an existing'
say 'binary file.'
say 'The result file of the copy is placed in'
say 'this directory, under the name TEMP.BIN.'
say ' '
say 'WARNING! This example takes forever to execute'
say 'with large files..'
loop until fname.length() \= 0
say ' '
say 'Please enter a valid file name..'
say ' '
say 'Example: c:\\filename.exe'
say ' '
ok = File1.charout("File name>")
fname = stdin.linein()
if (File1.stream(fname,"c", "query exists")).length() = 0 then
do
fname = ""
say "That file doesn't exists."
end
end
File2.delete("temp.bin")
ok = File1.stream(fname, "c","open read")
ok = File2.stream("temp.bin","c","open write")
count = 0
loop while File1.chars() > 0
bytes = File1.charin()
count = count + 1
ok = File2.charout(bytes)
end
say count 'bytes copied.'